import Vobj from "./Vobj";
import Gobj from "./Gobj";
import Gstatic from "./Gstatic";
import GameWx from "../GameWx";

export default class VTower extends Vobj{

    constructor(){
        super();
        this.graphics.drawRect(0,0,80,80,null,"#ff0000");
        this.graphics.drawCircle(40,40,10,"#ff0000");
        this.pivotX = 40;
        this.pivotY = 40;
    }

    init(o: Gobj) {
        this.graphics.clear();
        if(o.pid==1){
            this.graphics.drawRect(0,0,80,80,null,"#ff0000");
            this.graphics.drawCircle(40,40,10,"#ff0000");
        }else{
            this.graphics.drawRect(0,0,80,80,null,"#ffff00");
            this.graphics.drawCircle(40,40,10,"#ffff00");
        }

        var xx = Math.floor(o.x / 100);
        var yy = Math.floor(o.y / 100);

        if (this.isUP(o)) { //1 == 房主
            this.x = this.sx = 665;
            this.y = this.sy = 80;
            this.x = this.sx - xx;
            this.y = this.sy + yy;
        } else {
            this.x = this.sx = 85;
            this.y = this.sy = 1260;
            this.x = this.sx + xx;
            this.y = this.sy - yy;
        }
        
    }
}